package com.zhu.day.factory;

import java.util.Objects;

public class MainClass {


    public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {

        //通过调用工厂类的静态方法getFruit，创建水果的子类实例。
        for (int i = 0; i < 5; i++) {
            DoPromotion promotion = PromotionFactory.getDoPromotionFactory("Promotion"+i);
            if (Objects.nonNull(promotion)){
                String s = promotion.doPromotion(i);
                System.out.println(s);

            }

        }

    }
}
